// components/my-goods/my-goods.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        goods:{
            type:Object,
            value:{}
        },
        showRadio:{
            type:Boolean,
            value:false
        },
        showNum:{
            type:Boolean,
            value:false
        }
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        radioClickHandler(e){
            this.setData({
                ['goods.goods_state']:e.detail
            })

            this.triggerEvent('radioChange',{
                goods_id: this.data.goods.goods_id,
                goods_state: this.data.goods.goods_state
              })
        },
        clickBox(){
            this.triggerEvent('gotoDetail',{
                goods_id: this.data.goods.goods_id,
              })
        },
        // 当计数器发生变化时
        onChange(e){
            this.setData({
                ['goods.goods_count']:e.detail
            })
            // 触发父组件中的事件
            this.triggerEvent('numChange',{
                goods_id: this.data.goods.goods_id,
                goods_count: this.data.goods.goods_count
              })
        }
    },
    pageLifetimes:{

    }
})
